Data write system and method

ABSTRACT

A data write system includes a processor circuit, a first memory, at least one register, and a second memory. The first memory is coupled to the processor circuit. The at least one register is configured to define at least one range. The second memory is coupled to the first memory. If a cache miss occurs and an access address of a reading command is in the at least one range in the second memory, a predetermined amount of data corresponding to the access address is written from the second memory into at least one first way of the first memory.

RELATED APPLICATIONS

This application claims priority to Taiwanese Application Serial Number109106958, filed Mar. 3, 2020, which is herein incorporated byreference.

BACKGROUND Technical Field

The present disclosure relates to a cache technology. More particularly,the present disclosure relates to a data write system and a data writemethod suitable for cache memories.

Description of Related Art

In memory technology, a cache memory can work coordination with a mainmemory to store data. Compared to the main memory, the operation speedof the cache memory is faster. Accordingly, operation efficiency of theentire system can be increased by utilizing the cache memory.

However, it is an important issue in this field that how to reduce costor reduce an area of a circuitry in a situation that the cache memory isdisposed in the system.

SUMMARY

Some aspects of the present disclosure are to provide a data writesystem. The data write system includes a processor circuit, a firstmemory, at least one register, and a second memory. The first memory iscoupled to the processor circuit. The at least one register isconfigured to define at least one range. The second memory is coupled tothe first memory. If a cache miss occurs and an access address of areading command is in the at least one range in the second memory, apredetermined amount of data corresponding to the access address iswritten from the second memory into at least one first way of the firstmemory.

Some aspects of the present disclosure are to provide a data writemethod. The data write method includes following steps: determiningwhether a cache miss occurs and whether an access address of a readingcommand is in at least one range in a first memory; and if yes, apredetermined amount of data corresponding to the access address iswritten from the first memory into at least one first way of a secondmemory. The at least one range is defined by at least one register.

As shown in the above embodiments, the data write system and the datawrite method of the present disclosure do not need to dispose othermemory (for example, dynamic random access memory), and thus can reducecost and the circuit area.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of a data write system according to someembodiments of the present disclosure.

FIG. 2 is a schematic diagram of a cache memory according to someembodiments of the present disclosure.

FIG. 3 is a flow diagram illustrating a data write method according tosome embodiments of the present disclosure.

DETAILED DESCRIPTION

Reference is now made in detail to the present embodiments of thedisclosure, examples of which are illustrated in the accompanyingdrawings. Wherever possible, the same reference numbers are used in thedrawings and the description to refer to the same or like parts. Theembodiments below are described in detail with the accompanyingdrawings, but the examples provided are not intended to limit the scopeof the disclosure covered by the description. The structure andoperation are not intended to limit the execution order. Any structureregrouped by elements, which has an equal effect, is covered by thescope of the present disclosure.

In the present disclosure, “connected” or “coupled” may refer to“electrically connected” or “electrically coupled.” “Connected” or“coupled” may also refer to operations or actions between two or moreelements.

Reference is made to FIG. 1. FIG. 1 is a schematic diagram of a datawrite system 100 according to some embodiments of the presentdisclosure. As illustrated in FIG. 1, the data write system 100 includesa core processor circuit 120, a cache memory 140, a memory 160, andregisters R1-R3.

In some embodiments, the memory 160 is implemented by a NAND flashmemory. Since the price of the NAND flash memory is lower, cost of thedata write system 100 is lower by utilizing the NAND flash memory.

The registers R1-R3 are coupled to the core processor circuit 120respectively. The core processor circuit 120 is coupled to the cachememory 140 and the memory 160. The cache memory 140 is coupled to thememory 160.

The operation speed of the cache memory 140 is faster. Accordingly, forincreasing the operation efficiency of the system, when the coreprocessor circuit 120 receives a reading command, the core processorcircuit 120 reads the cache memory 140 first. However, if the data to beread is not in the cache memory 140 and the data to be read is in thememory 160, the core processor circuit 120 receives the data from thememory 160 directly. At the same time, the data to be read is writtenfrom the memory 160 into the cache memory 140, such that the coreprocessor circuit 120 can read the data from the cache memory 140 in thefuture.

In some embodiments, the register R1 is configured to store base addressinformation BA, and the register R2 is configured to store top addressinformation TA. The base address information BA and the top addressinformation TA can define a range in the memory 160. In someembodiments, the register R1 is configured to store start addressinformation, and the register R2 is configured to store sizeinformation. The start address information and the size information candefine a range in the memory 160. In some other embodiments, the datawrite system 100 may include multiple registers R1 and multipleregisters R2, to define two or more than two ranges.

References are made to FIG. 1 and FIG. 2. FIG. 2 is a schematic diagramof the cache memory 140 according to some embodiments of the presentdisclosure.

As illustrated in FIG. 2, the cache memory 140 includes multiple waysW0-W2. The quantity of the ways is merely for illustration, and variousquantities of the ways are within contemplated scopes of the presentdisclosure. For example, the quantity of the cache memory 140 may besmaller than or larger than 3. If the quantity of the cache memory 140is larger than 1, it can prevent data from changing rapidly (forexample, data is replaced by another data rapidly), to increase thecache hit rate.

The register R3 is configured to store assigning information AI. Theassigning information AI is configured to record a quantity of ways of afirst portion P1 in the cache memory 140 and a quantity of ways of asecond portion P2 in the cache memory 140. The ways of the first portionP1 is configured to store data from the memory 160, and the ways of thesecond portion P2 is configured to store data from a static randomaccess memory (SRAM). In other words, the data from the memory 160 andthe data from the data from the static random access memory are storedinto different ways.

As illustrate in FIG. 2, the first portion P1 includes a way W0 and away W1. The second portion P2 includes a way W2. In other words, aquantity of ways for storing the data from the memory 160 is 2 (forexample, the way W0 and the way W1), and a quantity of ways for storingthe data from the static random access memory is 1 (for example, the wayW2). The quantity of the ways of the first portion P1 and the quantityof the ways of the second portion P2 are merely for illustration, andvarious quantities are within contemplated scopes of the presentdisclosure. For example, the quantity of the ways of the first portionP1 may be smaller than or larger than 2, and the quantity of the ways ofthe second portion P2 may be larger than 1.

In some embodiments, a capacity of a cache line in the way W0 (or theway W1) is different from a capacity of a cache line in the way W2. Asillustrated in FIG. 2, a capacity of a cache line CL0 in the way W0 issmaller than a capacity of a cache line CL2 in the way W2. In some otherembodiments, a capacity of a cache line in the way W0 (or the way W1)may be the same to a capacity of a cache line in the way W2. A capacityof a cache line is also referred to a cache line size or a block size.

In operation, when the core processor circuit 120 receives a readingcommand and needs to read data corresponding to an access address AA1,the core processor circuit 120 can read the cache memory 140 accordingto the access address AA1.

As Illustrated in FIG. 2, the access address AA1 includes a tag filedTAG1, an index filed INDEX, and an offset filed OFFSET. Based on theindex filed INDEX, a corresponding row can be determined. Correspondingdata DATA can be determined by comparing the tag filed TAG1 with taginformation TAG2 in the corresponding row1. Based on the offset filedOFFSET, a corresponding bit can be determined from the correspondingdata DATA.

For example, if the index filed INDEX indicates the 6th row, acomparator circuit 141 compares the tag filed TAG1 with the taginformation TAG2 in the 6th row. If the tag information TAG2 of the wayW1 is matched to the tag filed TAG1, a “cache hit” occurs. In otherwords, the data to be read is in the way W1 of the cache memory 140.Accordingly, a comparator 1411, corresponding to the way W1, of thecomparator circuit 141, outputs a hit signal HIT with a logic value 1,and a buffer 1421, corresponding to the way W1, of a selector circuit142 selects a corresponding bit in corresponding data DATA of the way W1according to the offset filed OFFSET and output the corresponding bit toan output circuit 143. Then, the output circuit 143 outputs thecorresponding bit according to the hit signal HIT with a logic value 1,to be output data DATA_OUT. Then, the core processor circuit 120receives the output data DATA_OUT, and the reading process is finished.

If the tag information TAG2 in the 6th row is not matched to the tagfiled TAG1, a “cache miss” occurs. In other words, the data to be readis not in the cache memory 140 and may be in the memory 160.Accordingly, the comparator circuit 141 outputs a hit signal HIT with alogic value 0. The output circuit 143 outputs data MEM_DATA to be readin the memory 160 according to the hit signal HIT with a logic value, tobe an output data DATA_OUT. Then, the core processor circuit 120receives the output data DATA_OUT. In addition, as shown in the aboveembodiments, the data MEM_DATA to be read is also written into the cachememory 140, such that the core processor circuit 120 can directly readthe cache memory 140 to acquire the data in the future.

In some embodiments, the output circuit 143 is implemented by amultiplexer. It is noted that the implementations of the comparatorcircuit 141, the selector circuit 142, and the output circuit 143 aremerely for illustration, but the present disclosure is not limitedthereto.

How the data in the memory 160 is written into the cache memory 140directly (without passing through other memory) is described infollowing paragraphs.

As shown in the above embodiments, one range in the memory 160 isdefined by the base address information BA and the top addressinformation TA. When a cache miss occurs and the access address AA1 isin the range, a predetermined amount of data in the memory 160corresponding to the access address AA1 is written into the way W0 (orthe way W1) of the cache memory 140.

In some embodiments, the predetermined amount of data is larger than acapacity of a cache line in the way W0. For example, the predeterminedamount of data is corresponding to a page. In other words, a page ofdata corresponding to the access address AA1 or a page of data includingdata of the access address AA1 is written into the cache memory 140. Thepage of data may be larger than a capacity of the cache line CL0 in theway W0. For example, a page of data in the memory 160 is correspondingto 1024 bytes, and the capacity of the cache line CL0 in the way W0merely is four bytes. In this situation, it needs 256 cache lines tostore the page of data. Accordingly, a page of data from the memory 160is written into 256 cache lines in the way W0. Data from a static randomaccess memory (SRAM) is written into the way W2. In other words, thedata from the memory 160 and the data from the SRAM are written intodifferent ways.

In some other embodiments, if the cache memory 140 merely includes oneway (for example, the way W0), a page of data from the memory 160 iswritten into 256 cache lines in the way W0, and data from the SRAM iswritten into other cache lines in the way W0. In other words, in theseembodiments, the data from the memory 160 and the data from the SRAM arewritten into different cache lines in the same way (for example, the wayW0).

In some related approaches, data to be read is written from the memory160 (for example, the NAND flash memory) to an additional memory (forexample, dynamic random access memory). Then, the data to be read iswritten to the cache memory 140 from this additional memory, such thatthe core processor circuit 120 can directly read the cache memory 140 toacquire the data in the future. However, disposing this additionalmemory increases cost and the circuit area. Compared to the relatedapproaches above, in the present disclosure, the data to be read can bewritten into the cache memory 140 from the memory 160 (for example, theNAND flash memory) directly. Thus, without disposing the aforementionedadditional memory, cost and the circuit area can be reduced. Inaddition, as shown in the above embodiments, in some embodiments, costof the data write system 100 can be reduced by utilizing the NAND flashmemory (the memory 160).

Reference is made to FIG. 3. FIG. 3 is a flow diagram illustrating adata write method 300 according to some embodiments of the presentdisclosure. The data write method 300 includes operations S310 andoperation S320. The data write method 300 may be applied to the datawrite system 100 in FIG. 1, but the present disclosure is not limitedthereto. For ease of understanding, the data write method 300 isdiscussed with reference to FIG. 1 and FIG. 2.

The operation S310 is for determining whether the cache miss occurs andwhether the access address AA1 of the reading command is in the at leastone range in the memory 160. In some embodiments, the range is definedby the base address information BA and the top address information TA.In some embodiments, the range is defined by start address informationand the size information.

In operation S320, if the determination of the operation S310 is yes,the predetermined amount of data corresponding to the access address AA1is written from the memory 160 into the way W0 of the cache memory 140,such that the core processor circuit 120 can directly read the data inthe cache memory 140 in the future. In some embodiments, thepredetermined amount of data is corresponding to a page, and a capacityof a page is greater than a capacity of the cache line CL0 in the wayW0. Accordingly, the data is written in multiple cache lines in the wayW0.

As shown in the above embodiments, the data write system and the datawrite method of the present disclosure do not need to dispose othermemory (for example, dynamic random access memory), and thus can reducecost and the circuit area.

Various functional components or blocks have been described herein. Aswill be appreciated by persons skilled in the art, in some embodiments,the functional blocks will preferably be implemented through circuits(either dedicated circuits, or general purpose circuits, which operateunder the control of one or more processors and coded instructions),which will typically comprise transistors or other circuit elements thatare configured in such a way as to control the operation of thecircuitry in accordance with the functions and operations describedherein. As will be further appreciated, the specific structure orinterconnections of the circuit elements will typically be determined bya compiler, such as a register transfer language (RTL) compiler. RTLcompilers operate upon scripts that closely resemble assembly languagecode, to compile the script in a form that is used for the layout orfabrication of the ultimate circuitry. Indeed, RTL is well known for itsrole and use in the facilitation of the design process of electronic anddigital systems.

Although the present disclosure has been described in considerabledetail with reference to certain embodiments thereof, other embodimentsare possible. Therefore, the spirit and scope of the appended claimsshould not be limited to the description of the embodiments containedherein.

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the structure of the presentdisclosure without departing from the scope or spirit of the disclosure.In view of the foregoing, it is intended that the present disclosurecover modifications and variations of this disclosure provided they fallwithin the scope of the following claims.

What is claimed is:
 1. A data write system, comprising: a processorcircuit; a first memory coupled to the processor circuit; at least oneregister configured to define at least one range; and a second memorycoupled to the first memory, wherein if a cache miss occurs and anaccess address of a reading command is in the at least one range in thesecond memory, a predetermined amount of data corresponding to theaccess address is written from the second memory into at least one firstway of the first memory.
 2. The data write system of claim 1, wherein atleast one second way of the first memory is configured to store datafrom a static random access memory.
 3. The data write system of claim 2,wherein a capacity of the at least one second way is different from acapacity of the at least one first way.
 4. The data write system ofclaim 1, wherein the second memory is a flash memory.
 5. The data writesystem of claim 1, wherein the at least one register comprises: a firstregister configured to store base address information; a second registerconfigured to store top address information, wherein the base addressinformation and the top address information define the at least onerange; and a third register configured to store assigning information,wherein the assigning information is configured to record a quantity ofthe at least one first way.
 6. The data write system of claim 1, whereinthe predetermined amount of data is corresponding to a page.
 7. The datawrite system of claim 1, wherein the predetermined amount of data islarger than a capacity of a cache line in the at least one first way. 8.The data write system of claim 7, wherein the predetermined amount ofdata is stored into a plurality of first cache lines in the at least onefirst way.
 9. The data write system of claim 8, wherein at least onesecond cache line in the at least one first way is configured to storedata from a static random access memory.
 10. The data write system ofclaim 1, wherein a quantity of the at least one first way is equal to orlarger than
 2. 11. The data write system of claim 1, wherein a quantityof at least one range is equal to or larger than
 2. 12. A data writemethod, comprising: determining whether a cache miss occurs and whetheran access address of a reading command is in at least one range in afirst memory; and if yes, a predetermined amount of data correspondingto the access address is written from the first memory into at least onefirst way of a second memory, wherein the at least one range is definedby at least one register.
 13. The data write method of claim 12, furthercomprising: storing data from a static random access memory into atleast one second way of the second memory.
 14. The data write method ofclaim 13, wherein a capacity of a cache line in the at least one secondway is different from a capacity of a cache line in the at least onefirst way.
 15. The data write method of claim 12, wherein the firstmemory is a flash memory.
 16. The data write method of claim 12, furthercomprising: storing base address information in a first register;storing top address information in a second register; and storingassigning information into a third register, wherein the base addressinformation and the top address information define the at least onerange, and wherein the assigning information is configured to record aquantity of the at least one first way.
 17. The data write method ofclaim 12, wherein the predetermined amount of data is corresponding to apage.
 18. The data write method of claim 12, wherein the predeterminedamount of data is larger than a capacity of a cache line in the at leastone first way.
 19. The data write method of claim 18, furthercomprising: storing the predetermined amount of data into a plurality offirst cache lines in the at least one first way.
 20. The data writemethod of claim 19, further comprising: storing data from a staticrandom access memory into at least one second cache line in the at leastone first way.